package com.byit.Test.wait;


/**
 * @ClassName Main
 * @Description TODO
 * @Author lxp
 * @Date 2018/10/8 0008
 **/
public class Main {

    public static void main(String[] args) throws Exception {
        Object a = new Object();
        Object b = new Object();
        Object c = new Object();
        Object d = new Object();
        ThreadWait pa = new ThreadWait("A", d, a);
        ThreadWait pb = new ThreadWait("B", a, b);
        ThreadWait pc = new ThreadWait("C", b, c);
        ThreadWait pd = new ThreadWait("D", c, d);


        new Thread(pa).start();
        Thread.sleep(100);  //确保按顺序A、B、C执行
        new Thread(pb).start();
        Thread.sleep(100);
        new Thread(pc).start();
        Thread.sleep(100);
        new Thread(pd).start();
        Thread.sleep(100);
    }
}

